1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.ConstraintGuide;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import glib.c.functions;
30 private import gobject.ObjectG;
31 private import gtk.ConstraintTargetIF;
32 private import gtk.ConstraintTargetT;
33 private import gtk.c.functions;
34 public  import gtk.c.types;
35 
36 
37 /**
38  * A `GtkConstraintGuide` is an invisible layout element in a
39  * `GtkConstraintLayout`.
40  * 
41  * The `GtkConstraintLayout` treats guides like widgets. They
42  * can be used as the source or target of a `GtkConstraint`.
43  * 
44  * Guides have a minimum, maximum and natural size. Depending
45  * on the constraints that are applied, they can act like a
46  * guideline that widgets can be aligned to, or like *flexible
47  * space*.
48  * 
49  * Unlike a `GtkWidget`, a `GtkConstraintGuide` will not be drawn.
50  */
51 public class ConstraintGuide : ObjectG, ConstraintTargetIF
52 {
53 	/** the main Gtk struct */
54 	protected GtkConstraintGuide* gtkConstraintGuide;
55 
56 	/** Get the main Gtk struct */
57 	public GtkConstraintGuide* getConstraintGuideStruct(bool transferOwnership = false)
58 	{
59 		if (transferOwnership)
60 			ownedRef = false;
61 		return gtkConstraintGuide;
62 	}
63 
64 	/** the main Gtk struct as a void* */
65 	protected override void* getStruct()
66 	{
67 		return cast(void*)gtkConstraintGuide;
68 	}
69 
70 	/**
71 	 * Sets our main struct and passes it to the parent class.
72 	 */
73 	public this (GtkConstraintGuide* gtkConstraintGuide, bool ownedRef = false)
74 	{
75 		this.gtkConstraintGuide = gtkConstraintGuide;
76 		super(cast(GObject*)gtkConstraintGuide, ownedRef);
77 	}
78 
79 	// add the ConstraintTarget capabilities
80 	mixin ConstraintTargetT!(GtkConstraintGuide);
81 
82 
83 	/** */
84 	public static GType getType()
85 	{
86 		return gtk_constraint_guide_get_type();
87 	}
88 
89 	/**
90 	 * Creates a new `GtkConstraintGuide` object.
91 	 *
92 	 * Returns: a new `GtkConstraintGuide` object.
93 	 *
94 	 * Throws: ConstructionException GTK+ fails to create the object.
95 	 */
96 	public this()
97 	{
98 		auto __p = gtk_constraint_guide_new();
99 
100 		if(__p is null)
101 		{
102 			throw new ConstructionException("null returned by new");
103 		}
104 
105 		this(cast(GtkConstraintGuide*) __p, true);
106 	}
107 
108 	/**
109 	 * Gets the maximum size of @guide.
110 	 *
111 	 * Params:
112 	 *     width = return location for the maximum width
113 	 *     height = return location for the maximum height
114 	 */
115 	public void getMaxSize(out int width, out int height)
116 	{
117 		gtk_constraint_guide_get_max_size(gtkConstraintGuide, &width, &height);
118 	}
119 
120 	/**
121 	 * Gets the minimum size of @guide.
122 	 *
123 	 * Params:
124 	 *     width = return location for the minimum width
125 	 *     height = return location for the minimum height
126 	 */
127 	public void getMinSize(out int width, out int height)
128 	{
129 		gtk_constraint_guide_get_min_size(gtkConstraintGuide, &width, &height);
130 	}
131 
132 	/**
133 	 * Retrieves the name set using gtk_constraint_guide_set_name().
134 	 *
135 	 * Returns: the name of the guide
136 	 */
137 	public string getName()
138 	{
139 		return Str.toString(gtk_constraint_guide_get_name(gtkConstraintGuide));
140 	}
141 
142 	/**
143 	 * Gets the natural size of @guide.
144 	 *
145 	 * Params:
146 	 *     width = return location for the natural width
147 	 *     height = return location for the natural height
148 	 */
149 	public void getNatSize(out int width, out int height)
150 	{
151 		gtk_constraint_guide_get_nat_size(gtkConstraintGuide, &width, &height);
152 	}
153 
154 	/**
155 	 * Retrieves the strength set using gtk_constraint_guide_set_strength().
156 	 *
157 	 * Returns: the strength of the constraint on the natural size
158 	 */
159 	public GtkConstraintStrength getStrength()
160 	{
161 		return gtk_constraint_guide_get_strength(gtkConstraintGuide);
162 	}
163 
164 	/**
165 	 * Sets the maximum size of @guide.
166 	 *
167 	 * If @guide is attached to a `GtkConstraintLayout`,
168 	 * the constraints will be updated to reflect the new size.
169 	 *
170 	 * Params:
171 	 *     width = the new maximum width, or -1 to not change it
172 	 *     height = the new maximum height, or -1 to not change it
173 	 */
174 	public void setMaxSize(int width, int height)
175 	{
176 		gtk_constraint_guide_set_max_size(gtkConstraintGuide, width, height);
177 	}
178 
179 	/**
180 	 * Sets the minimum size of @guide.
181 	 *
182 	 * If @guide is attached to a `GtkConstraintLayout`,
183 	 * the constraints will be updated to reflect the new size.
184 	 *
185 	 * Params:
186 	 *     width = the new minimum width, or -1 to not change it
187 	 *     height = the new minimum height, or -1 to not change it
188 	 */
189 	public void setMinSize(int width, int height)
190 	{
191 		gtk_constraint_guide_set_min_size(gtkConstraintGuide, width, height);
192 	}
193 
194 	/**
195 	 * Sets a name for the given `GtkConstraintGuide`.
196 	 *
197 	 * The name is useful for debugging purposes.
198 	 *
199 	 * Params:
200 	 *     name = a name for the @guide
201 	 */
202 	public void setName(string name)
203 	{
204 		gtk_constraint_guide_set_name(gtkConstraintGuide, Str.toStringz(name));
205 	}
206 
207 	/**
208 	 * Sets the natural size of @guide.
209 	 *
210 	 * If @guide is attached to a `GtkConstraintLayout`,
211 	 * the constraints will be updated to reflect the new size.
212 	 *
213 	 * Params:
214 	 *     width = the new natural width, or -1 to not change it
215 	 *     height = the new natural height, or -1 to not change it
216 	 */
217 	public void setNatSize(int width, int height)
218 	{
219 		gtk_constraint_guide_set_nat_size(gtkConstraintGuide, width, height);
220 	}
221 
222 	/**
223 	 * Sets the strength of the constraint on the natural size of the
224 	 * given `GtkConstraintGuide`.
225 	 *
226 	 * Params:
227 	 *     strength = the strength of the constraint
228 	 */
229 	public void setStrength(GtkConstraintStrength strength)
230 	{
231 		gtk_constraint_guide_set_strength(gtkConstraintGuide, strength);
232 	}
233 }